package com.tbit.uqbike.webmanager.business.brandshare.pojo.vo;

import lombok.Data;

import javax.validation.constraints.NotEmpty;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 品牌共享配置信息-addVo
 *
 * @author: qiu.longjie
 * @create: 2025-05-19
 */
@Data
public class BrandShareConfigAddVO {

    /**
     * 配置名称
     */
    @NotEmpty(message = "配置名称不能为空")
    private String configName;
    /**
     * 品牌ID列表，逗号分隔
     */
    @NotEmpty(message = "品牌ID列表不能为空")
    private String brandIds;

    public List<Integer> getBrandIdList(){
        if  (brandIds != null && !brandIds.isEmpty()) {
            return Arrays.stream(brandIds.split(",")).map(Integer::parseInt).collect(Collectors.toList());
        }
        return Collections.emptyList();
    }
}
